Skip to content

feat(tui): paste primary selection on middle click - #44938

Closed
sshnaidm wants to merge 1 commit into
anomalyco:devfrom
sshnaidm:middle-click-paste
Closed

feat(tui): paste primary selection on middle click#44938
sshnaidm wants to merge 1 commit into
anomalyco:devfrom
sshnaidm:middle-click-paste

Conversation

@sshnaidm

Copy link
Copy Markdown

Summary

  • Middle click now pastes the X11/Wayland PRIMARY selection into the prompt on Linux, restoring the traditional terminal gesture that was lost when the TUI enables mouse capture
  • Adds readPrimary() to the clipboard module (wl-paste → xclip → xsel fallback chain) and exposes it as an optional readPrimary method on ClipboardService
  • Registers a hidden prompt.paste.primary command in the prompt and dispatches it from the app root on middle-button mouse down; copy-on-select mouse-up is skipped for middle button so it doesn't clobber the clipboard

Test plan

  • bun test in packages/tui (new tests for readPrimaryCommand fallbacks)
  • bun typecheck in packages/tui
  • Manual: select text with left drag, middle click in prompt area — text is pasted (Linux, X11 and Wayland)

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

PR #32370: feat(tui): add linux_clipboard_selection config for primary buffer support
#32370

  • Directly related to PRIMARY selection handling on Linux; likely addresses the same clipboard/selection functionality

PR #6370: fix: enable primary clipboard copy for Wayland/X11 to fix Linux middle-click paste
#6370

PR #44443: feat(tui): add selection to prompt as quoted context
#44443

  • Related to selection handling in the prompt, though likely a different feature

I recommend reviewing PR #32370 and #6370 to ensure PR #44938 doesn't duplicate existing work or conflicts with prior clipboard/selection implementations.

@sshnaidm

Copy link
Copy Markdown
Author

Closing as duplicate of #32370 #6370 #44443
Hopefully one of them will merge 🙏

@sshnaidm sshnaidm closed this Aug 25, 2026
@bornmw

bornmw commented Aug 29, 2026

Copy link
Copy Markdown

Thanks for tracking these down. To disentangle them — they're not really duplicates of each other, they're the different halves of the same feature:

So #32370 isn't duplicating #44938 or #44443 at all — the only overlap is #6370's write path, which it extends rather than repeats. Happy to merge in #44938's middle-click dispatch if/when the write side lands; the ClipboardService API in #32370 is structured to accept a read(selection) extension.

Fwiw, current dev has no primary-selection support yet, so one of these is still needed — and #6370 has been sitting since Dec 2025 and would conflict with either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants